#include "CBaseObject.h"

CBaseObject::CBaseObject(void)
{
}

CBaseObject::~CBaseObject(void)
{
}

bool CBaseObject::setPosition(float fX, float fY, float fZ)
{
	if(m_scnodPlayerNode == NULL)
	{
		writeDebugOutput("CBaseObject::setPosition(): SceneNode is NULL!. Aborting!");
		return false;
	}

	m_scnodPlayerNode->setPosition(Ogre::Real(fX), Ogre::Real(fY), Ogre::Real(fZ));

	return true;
}

bool CBaseObject::setDirection(float fX, float fY, float fZ)
{
	if(m_scnodPlayerNode == NULL)
	{
		writeDebugOutput("CBaseObject::setDirection(): SceneNode is NULL!. Aborting!");
		return false;
	}

	m_scnodPlayerNode->setDirection(Ogre::Real(fX), Ogre::Real(fY), Ogre::Real(fZ), Ogre::Node::TS_WORLD);

	return true;
}

bool CBaseObject::getPosition(float *pfX, float *pfY, float *pfZ)
{
	if((pfX == NULL)||(pfX == NULL)||(pfX == NULL))
	{
		writeDebugOutput("CBaseObject::getPosition(): Some pointers are not allocated! Aborting!");
		return false;
	}

	if(m_scnodPlayerNode == NULL)
	{
		writeDebugOutput("CBaseObject::getPosition(): SceneNode is NULL!. Aborting!");
		return false;
	}

	Ogre::Vector3 v3Temp;

	v3Temp = m_scnodPlayerNode->getPosition();

	*pfX = (float)v3Temp.x;
	*pfY = (float)v3Temp.y;
	*pfZ = (float)v3Temp.z;

	return true;
}

bool CBaseObject::getDirection(float *pfX, float *pfY, float *pfZ)
{
	// TODO: implement getDirection
	writeDebugOutput("CBaseObject::getDirection(): not yet implemented!");

	return true;
}

Ogre::SceneNode *CBaseObject::getSceneNode()
{
	if(m_scnodPlayerNode == NULL)
	{
		writeDebugOutput("CBaseObject::getSceneNode(): SceneNode is NULL!. Aborting!");
		return false;
	}

	return m_scnodPlayerNode;
}

void CBaseObject::setSceneNode(Ogre::SceneNode* SceneNode)
{
	m_scnodPlayerNode = SceneNode;
	return;
}

Ogre::Vector3 *CBaseObject::getv3Position()
{
	return &m_v3Position;
}

Ogre::Vector3 *CBaseObject::getv3Direction()
{
	return &m_v3Direction;
}